function sendMessageToContentScript(message, callback) {
    chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
        chrome.tabs.sendMessage(tabs[0].id, message, function(response) {
            if (callback) callback(response);
        });
    });
}


$("#start").click(function() {
    sendMessageToContentScript({ start: true }, function(response) {
        if (chrome.runtime.lastError) {
            console.log(chrome.runtime.lastError);
        }
    });
});


$("#new").click(function() {
    chrome.tabs.create({ url: chrome.runtime.getURL("src/new.html") });
});